{include "header.tpl"}

{capture assign=pnm}{$product->name()} {$manufacturer->name()} {$product->model()}{/capture}

<div id='product-details'>

	<div class="product img-box" style="float:left;">
		<a href="/{$boat.image[0].source}" rel="shadowbox[1]" title="{$boat.name}">
			<img src='{$boat.image[0].url}' alt="{$boat.name}" title="{$boat.name}" class='vcenter' style="width:{$boat.image[0].width}px; height:{$boat.image[0].height}px; margin-left:4px;" />
		</a>					
		<a href="/{$motor.image[0].source}" rel="shadowbox[1]" title="{$motor.name}">
			<img src='{$motor.image[0].url}' alt="{$motor.name}" title="{$motor.name}" class='vcenter' style="width:{$motor.image[0].width}px; height:{$motor.image[0].height}px; margin-right:4px;" />
		</a>

		<div class='boatplusmotor'></div>
			
		{if $isNew}
			<div class='newProduct'></div>
		{/if}
	</div>
	
	<div style="float:left; padding-left:10px;">
		{if $product->hasPrice()}
			<dl class='price'>
				<dt>
					{if $product->hasDiscount()}
						<span style="text-decoration: line-through;">
							{$product->priceNoDiscount()}
						</span>	
						&nbsp;&nbsp;
						<span class='newPrice'>
							{$product->price()}
						</span>
					{else}
						{$product->minPrice()}
					{/if}
				</dt>
				<dd>руб</dd>
			</dl>
			<a href="#" class="btn buy"         data-product='{$product->id()}'>КУПИТЬ</a>
			<a href="#" class="btn buy instant" data-product='{$product->id()}'>БЫСТРЫЙ ЗАКАЗ</a>
		{/if}
	</div>
	
	<div class='product-thumbnails'>
		<a href="/{$boat.image[1].source}" rel="shadowbox[2]" title="{$boat.name}">
			<img src='{$boat.image[1].url}' alt="{$boat.name}" title="{$boat.name}">
		</a>
		<a href="/{$motor.image[1].source}" rel="shadowbox[2]" title="{$motor.name}">
			<img src='{$motor.image[1].url}' alt="{$motor.name}" title="{$motor.name}">
		</a>
	</div>
	

	<div style="clear:both; padding-top:10px;">
		<table border=0 cellpadding=6 cellspacing=0>
			{foreach $options as $o}
				{if $o->hasPrice()}
					<tr valign=top>
						<td valign=bottom>
							<h2>{$o->name()}</h2>
						</td>
						<td valign=middle>
							{$o->descr()}
						</td>
						<td valign=middle>
							<dl class='price'>
								<dt>
									{$o->price()}
								</dt>
								<dd>руб</dd>
							</dl>
						
						</td>
						<td valign=middle style="white-space:nowrap;">
							<a href="#" class="btn buy"         data-product='{$product->id()}' data-option='{$o->id()}'>КУПИТЬ</a>
							<a href="#" class="btn buy instant" data-product='{$product->id()}' data-option='{$o->id()}'>БЫСТРЫЙ ЗАКАЗ</a>
						</td>
					</tr>
				{/if}
			{/foreach}
		</table>
	</div>

	{$product->shortDescr()}
	
	<br>
	<div id='tabhead'>
		<a href="#boat" class='active'>{if $boat.product->model()}{$boat.product->model()}{else}{$boat.product->name()}{/if}</a>
		<a href="#motor">{if $motor.product->model()}{$motor.product->model()}{else}{$motor.product->name()}{/if}</a>
	</div>
	
	<div class="tabs">
		<div id='boat'>
			<h2>{$boat.name}</h2>
			{if $boat.product->fullDescr()} {$boat.product->fullDescr()} {else} {$boat.product->shortDescr()} {/if}
			{if count($boat.attributes)}
				<br>
				<table class='attr_list'>
					<tbody>
						{$row=1}
						{foreach $boat.attributes[0][1] as $a}
							{if !$a->isNull()}
							<tr bgcolor="#{if $row is odd}ffffff{else}daeef7{/if}" data-bg="#{if $row is odd}ffffff{else}daeef7{/if}">
								<td style="white-space:nowrap;">
									{$a->name()}
								</td>
								<td>
									{$a->asString()}
								</td>
							</tr>
							{$row=$row+1}
							{/if}
						{/foreach}
					</tbody>
				</table>
			{/if}
		</div>
	
		<div id='motor' style="display:none;">
			<h2>{$motor.name}</h2>
			{if $motor.product->fullDescr()} {$motor.product->fullDescr()} {else} {$motor.product->shortDescr()} {/if}
			{if count($motor.attributes)}
				<br>
				<table class='attr_list'>
					<tbody>
						{foreach $motor.attributes[0][1] as $a}
							<tr bgcolor="#{if $a@iteration is odd}ffffff{else}daeef7{/if}" data-bg="#{if $a@iteration is odd}ffffff{else}daeef7{/if}">
								<td style="white-space:nowrap;">
									{$a->name()}
								</td>
								<td>
									{$a->asString()}
								</td>
							</tr>
						{/foreach}
					</tbody>
				</table>
			{/if}
		</div>
	</div>
</div>

<script>
	$(function(){
		$('.attr_list tbody tr').mouseover(function(){
			$(this).css('background-color','#e3f9ff');
		});
		$('.attr_list tbody tr').mouseout(function(){
			$(this).css('background-color',$(this).attr('data-bg'));
		});
		
		$('#tabhead a').click(function(){
			$('#tabhead a').removeClass('active');
			$('.tabs div').hide();
			$(this).addClass('active');
			$($(this).attr('href')).show();
			return false;
		});
	})
</script>

{if count($products)}
	<br>
	<h3>Вместе с этим товаром покупают</h3>
	{include "components/products.tpl"}
{/if}
<br>

{include "footer.tpl"}